
/*
 *  Copyright t lefering, David Given
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  These are the four essential freedoms with GNU GPL software:
 *  1: freedom to run the program, for any purpose
 *  2: freedom to study how the program works, and change it to make it do what you wish
 *  3: freedom to redistribute copies to help your Free Software friends
 *  4: freedom to distribute copies of your modified versions to your Free Software friends
 *   ,           ,
 *  /             \
 * ((__-^^-,-^^-__))
 * `-_---'  `---_-'
 *  `--|o`   'o|--'
 *      \  `  /
 *       ): :(
 *       :o_o:
 *        "-"
 */

var clue_initializer_list = [];

function clue_add_initializer(i)
{
	clue_initializer_list.push(i);
}

function clue_run_initializers()
{
	while (clue_initializer_list.length > 0)
		clue_initializer_list.shift()();
}

function clue_ptrtostring(po, pd)
{
	var s = [];
	var c;
	for (;;)
	{
		c = pd[po];
		if (c == 0)
			break;
		else
			s.push(c);
		po++;
	}
	
	return String.fromCharCode.apply(null, s);
}

function clue_newstring(s)
{
	var d = [];
	
	for (var i = 0; i < s.length; i++)
		d[i] = s.charCodeAt(i);
	d[s.length] = 0;
	
	return d;
}
